package com.rose.doorto.footbathdoor.util;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rose.doorto.footbathdoor.pojo.Address;

/**
 * 统一结果返回类
 * @Author 李庆超
 * @email 1481791489@qq.com
 * @Package：com.rose.doorto.footbathdoor.util
 * @Project：door-to-door
 * @name：Result
 * @date 2024/07/19 2024/7/19:9:17:
 */
public class Result<T> {

    private int code;  //状态码
    private String message;  //提示信息
    private T data;  //返回数据

    public static <T> Result<T> success(T data,int code,String message){
        Result<T> result = new Result<>();
        result.setMessage("请求成功");
        result.setData(data);
        result.setCode(code);
        return result;
    }

    public static <T> Result<T> error(int code,String message){
        Result<T> result = new Result<>();

        result.setMessage(message);
        //result.setData(data);
        return result;
    }

    public Result() {
    }


    public int getCode() {
        return code;
    }


    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Result(int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
}
